#include "dishitem.h"
#include "ui_dishitem.h"
#include "QToolButton"
#include "dishdetail.h"
DishItem::DishItem(QWidget *parent,long id, QString name,QString material,QString detail,QString pic,QString type) :
    QWidget(parent),
    ui(new Ui::DishItem),
    id(id),
    name(name),
    material(material),
    detail(detail),
    pic(pic)
{
    ui->setupUi(this);
    qDebug()<<"图片"<<pic;
    ui->label_pic->setParent(this);
    ui->label_pic->showURLImage(pic);
    ui->label_name->setText(name);
    QString c_detail = detail;
    ui->label_detail->setText("详情："+c_detail.replace("|"," ").mid(0,50)+" ......");
    QString c_material = material;
    ui->label_material->setText("材料："+c_material.replace("|"," ").mid(0,50)+" ......");
    connect(ui->btn_detail,&QToolButton::clicked,this,[=](){
        DishDetail* dishDetail = new DishDetail(this,name,material,detail,pic,type);
        dishDetail->show();
    });
}

DishItem::~DishItem()
{
    delete ui;
}
